package org.example;

import com.google.common.hash.BloomFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BloomFilterService {

    @Autowired
    private BloomFilter<String> bloomFilter;

    public boolean mightContain(String value) {
        return bloomFilter.mightContain(value);
    }

    public void add(String value) {
        bloomFilter.put(value);
    }

     public long ct() {
        return bloomFilter.approximateElementCount();
    }
}

